<?php
/*Los handlers sirven para manejar eventos propios del sistema, como puede ser crear un curso,
 * un usuario o un modulo.
 * Para manejar eventos relacionados a modulos (foros, archivos, encuentas, etc) se utilizan los observers.
 * Ejemplo: cuando se crea un foro, este evento se maneja mediante un handler relacionado al evento mod_created.
 * Cuando este mismo foro es visitado, modificado o se agregan temas en el, estos eventos se manejan mediante
 * observes.
 */

/*
 * Lista de eventos a registrar
 * course_created: Creacion de un curso (Grupo)
 * course_deleted: Curso eliminado
 * user_created: Creacion de usuario (Agente)
 * user_deleted: Usuario eliminado
 * user_enrolled: Asignar usuario a curso (Agente -> Grupo)
 * user_unenrolled: Eliminar usuario de curso
 * mod_created: Modulo de curso creado. A nosotros nos interesan los archivos, url, encuentas y tareas 
 * mod_deleted: Modulo eliminado
 */

$handlers = array (
		'course_created' => array (
				'handlerfile' => '/local/tesina/lib.php',
				'handlerfunction' => 'local_group_created',
				'schedule' => 'instant',
				'internal' => 1 
		),
		'course_deleted' => array (
				'handlerfile' => '/local/tesina/lib.php',
				'handlerfunction' => 'local_group_deleted',
				'schedule' => 'instant',
				'internal' => 1
		),
		'user_created' => array (
				'handlerfile' => '/local/tesina/lib.php',
				'handlerfunction' => 'local_agent_created',
				'schedule' => 'instant',
				'internal' => 1 
		),
		'user_deleted' => array (
				'handlerfile' => '/local/tesina/lib.php',
				'handlerfunction' => 'local_agent_deleted',
				'schedule' => 'instant',
				'internal' => 1
		),
		'user_enrolled' => array (
				'handlerfile' => '/local/tesina/lib.php',
				'handlerfunction' => 'local_agent_enrolled',
				'schedule' => 'instant',
				'internal' => 1 
		),
		'user_unenrolled' => array (
				'handlerfile' => '/local/tesina/lib.php',
				'handlerfunction' => 'local_agent_unenrolled',
				'schedule' => 'instant',
				'internal' => 1 
		),
		'mod_created' => array (
				'handlerfile' => '/local/tesina/lib.php',
				'handlerfunction' => 'local_mod_created',
				'schedule' => 'instant',
				'internal' => 1 
		),
		'mod_deleted' => array (
				'handlerfile' => '/local/tesina/lib.php',
				'handlerfunction' => 'local_mod_deleted',
				'schedule' => 'instant',
				'internal' => 1
		)
);

/*
 * mod_forum\event\course_module_viewed: Foro visto
 * mod_resource\event\course_module_viewed: Recurso visto
 * mod_url\event\course_module_viewed: URL vista
 * mod_forum\event\discussion_created: Discusion creada	dentro del foro
 * mod_forum\event\discussion_viewed: Discusion vista
 * mod_forum\event\discussion_deleted: Discusion eliminado
 * mod_forum\event\post_created: Mensaje dentro de una discusion creado
 * mod_forum\event\post_updated: Mensaje dentro de una discusion actualizado
 * mod_forum\event\post_deleted: Mensaje dentro de una discusion eliminado
   */

/*
 *  \core\event\course_viewed curso visto
 *  \assignsubmission_file\event\assessable_uploaded -> assignsubmission_file_uploaded
 *  \assignsubmission_file\event\submission_updated Accion: assignsubmission_file_updated
 *  \mod_assign\event\submission_graded -> assign_graded
  */

$observers = array(
		array(
				'eventname'   => 'core\event\course_viewed',
				'callback'    => 'local_group_viewed',
				'includefile' => '/local/tesina/lib.php'
		),
		array(
				'eventname'   => 'mod_assign\event\submission_status_viewed',
				'callback'    => 'local_assing_event',
				'includefile' => '/local/tesina/lib.php'
		),
		array(
				'eventname'   => 'mod_assign\event\submission_graded',
				'callback'    => 'local_assing_event',
				'includefile' => '/local/tesina/lib.php'
		),
		array(
				'eventname'   => 'mod_assign\event\extension_granted',
				'callback'    => 'local_assing_event',
				'includefile' => '/local/tesina/lib.php'
		),
		array(
				'eventname'   => 'assignsubmission_file\event\assessable_uploaded',
				'callback'    => 'local_assignsubmission_file_event',
				'includefile' => '/local/tesina/lib.php'
		),
		array(
				'eventname'   => 'assignsubmission_file\event\submission_updated',
				'callback'    => 'local_assignsubmission_file_event',
				'includefile' => '/local/tesina/lib.php'
		),
		array(
				'eventname'   => 'assignsubmission_comments\event\comment_created',
				'callback'    => 'local_event',
				'includefile' => '/local/tesina/lib.php'
		),		
		array(
				'eventname'   => 'mod_choice\event\course_module_viewed',
				'callback'    => 'local_event',
				'includefile' => '/local/tesina/lib.php'
		),
		array(
				'eventname'   => 'mod_choice\event\answer_submitted',
				'callback'    => 'local_event',
				'includefile' => '/local/tesina/lib.php'
		),
		array(
				'eventname'   => 'mod_choice\event\answer_updated',
				'callback'    => 'local_event',
				'includefile' => '/local/tesina/lib.php'
		),
		array(
				'eventname'   => 'mod_choice\event\report_viewed',
				'callback'    => 'local_event',
				'includefile' => '/local/tesina/lib.php'
		),
		array(
				'eventname'   => 'mod_forum\event\course_module_viewed',
				'callback'    => 'local_event',
				'includefile' => '/local/tesina/lib.php'
		),
		array(
				'eventname'   => 'mod_forum\event\assessable_uploaded',
				'callback'    => 'local_forum_file_event',
				'includefile' => '/local/tesina/lib.php'
		),
		array(
				'eventname'   => 'mod_forum\event\discussion_created',
				'callback'    => 'local_discussion_event',
				'includefile' => '/local/tesina/lib.php'
		),
		array(
				'eventname'   => 'mod_forum\event\discussion_deleted',
				'callback'    => 'local_discussion_event',
				'includefile' => '/local/tesina/lib.php'
		),
		array(
				'eventname'   => 'mod_forum\event\discussion_updated',
				'callback'    => 'local_discussion_event',
				'includefile' => '/local/tesina/lib.php'
		),
		array(
				'eventname'   => 'mod_forum\event\discussion_viewed',
				'callback'    => 'local_discussion_event',
				'includefile' => '/local/tesina/lib.php'
		),
		array(
				'eventname'   => 'mod_forum\event\post_created',
				'callback'    => 'local_post_event',
				'includefile' => '/local/tesina/lib.php'
		),
		array(
				'eventname'   => 'mod_forum\event\post_deleted',
				'callback'    => 'local_post_event',
				'includefile' => '/local/tesina/lib.php'
		),
		array(
				'eventname'   => 'mod_forum\event\post_updated',
				'callback'    => 'local_post_event',
				'includefile' => '/local/tesina/lib.php'
		),
		array(
				'eventname'   => 'mod_resource\event\course_module_viewed',
				'callback'    => 'local_event',
				'includefile' => '/local/tesina/lib.php'
		),
		array(
				'eventname'   => 'mod_url\event\course_module_viewed',
				'callback'    => 'local_event',
				'includefile' => '/local/tesina/lib.php'
		)
);
?>


